<%@ page language="java" contentType="text/html; charset=utf-8"
	pageEncoding="utf-8" isELIgnored="false"%>
<%@ include file="/WEB-INF/views/shared/taglib.jsp"%>
<%
	request.setAttribute("modelConfigPath", "bsexforms");
%>
<%
	//获取路径
	String contextPath = request.getContextPath();
	String path = request.getScheme() + "://" + request.getServerName()
			+ ":" + request.getServerPort() + contextPath;
%>
<!DOCTYPE html>
<html lang="en">
<head>
	<meta charset="utf-8">
	<meta http-equiv="renderer" content="webkit" />
    <meta http-equiv="X-UA-Compatible" content="IE=edge" />
    <meta http-equiv="X-UA-Compatible" content="chrome=1" />
	<meta name="viewport" content="width=device-width, initial-scale=1">
	<title>云忆-登陆</title>	
	<%@ include file="/WEB-INF/views/shared/css/bootstrap.jsp"%>
	<%@ include file="/WEB-INF/views/shared/css/limitless/default/common.jsp"%>
	<%@ include file="/WEB-INF/views/shared/css/limitless/default/animate.jsp"%>
	
	<%@ include file="/WEB-INF/views/shared/scripts/jquery.jsp"%>
	<%@ include file="/WEB-INF/views/shared/scripts/common.jsp"%>
	<%@ include file="/WEB-INF/views/shared/scripts/bootstrap.jsp"%>
	<%@ include file="/WEB-INF/views/shared/scripts/tools/md5.jsp"%>
	
	<style type="text/css">
		
		
		.login-cover{
			background-image: url("<#>") !important;
			opacity:0.92;
		}
	</style>
	<script type="text/javascript">		
		$(function() {
			var thinku=$.cookie("thinku");
			if(!$.isNull(thinku)){
				var thinkp=$.cookie("thinkp");	
				$("#login_username").val(thinku);
				$("#login_password").val("********");
				$(":input#rememberPassword").attr("checked","checked").val(thinkp);
			}
			
			var $inputs = $(":text,:password,:checkbox").not(":disabled").not("[readonly=readonly]");

			$inputs[0].focus();

			$inputs.each(function(index, item) {
				var $thisInput = $(this).keydown(function() {
					if (event.keyCode == "13") {//keyCode=13是回车键
						if (index + 1 < $inputs.length) {
							$inputs[index + 1].focus();
						} else {
							$("#loginbtn").click();
						}
					}
				});
			});
			
			//在二级窗体的时候
			if(top.window.document.title!=window.document.title){
				top.window.location.reload();
			}
		});
		function formLogin($login) {
			$login.button('loading');

			if (checkLogin()) {
				rememberPass();
				$("#loginform").submit();
			} else {
				$login.button('reset');
			}
		}

		function rememberPass(){
			if($(":input#rememberPassword:checked").length>0){
				var pass=$("#login_password").val();
				if("********"==pass&&!$.isNull($(":input#rememberPassword:checked").val())){
					return;
				}
				pass=$.md5(pass);
			//	document.write(pass.substr(1));
				$(":input#rememberPassword:checked").val("");
				$.cookie("thinku",$("#login_username").val(),{ expires: 30,path:$.getVirtualPath()+"/" });
				$.cookie("thinkp",pass,{ expires: 30,path:$.getVirtualPath()+"/" });
			}else{
				$.cookie("thinku",null);
				$.cookie("thinkp",null);
			}
		}
		
		
		function checkLogin() {
			var employeeName = $("#login_username").val();
			var employeePass = $("#login_password").val();
			
			if ($.isNull(employeeName)) {
				$.notify("用户名不能为空");
			
				return false;
			}
			if ($.isNull(employeePass)) {
				$.notify("密码不能为空");
				return false;
			}

			return true;
		}
	</script>
</head>
<body class="login-container login-cover">
<div class="page-container">
	<div class="page-content">
		<div class="content-wrapper">
			<div class="content pb-20">
				<form id="loginform" action="<c:url value='/admin/home/login'/>" method="post" class="form-validate">
					<input type="hidden" name="imgNum" value="${imgNum}">
					<div class="panel panel-body login-form">
						<div class="text-center">
							<div class="icon-object border-slate-300 text-slate-300">
								<span style="font-size:70px">忆</span>
							</div>
							<h5 class="content-group">云忆用户登录 <small class="display-block">请输入账号和密码后登陆</small></h5>
						</div>
						<div class="has-feedback has-feedback-left form-group">
							<input id="login_username" name="login_username" class="form-control custom-input" placeholder="请输入用户名" type="text" value="">
							<div class="form-control-feedback">
								<i class="icon-user text-muted"></i>
							</div>
						</div>
						<div class="has-feedback has-feedback-left form-group">
							<input id="login_password" name="login_password" class="form-control custom-input" placeholder="请输入密码" type="password" value="">
							<div class="form-control-feedback">
								<i class="icon-lock2 text-muted"></i>
							</div>
						</div>
						<div class="form-group login-options">
							<div class="row">
								<div class="col-sm-6">
									<label class="checkbox-inline">
										<input id="rememberPassword" name="rememberPassword" class="control-choice custom-styled" type="checkbox" value="">记住密码
									</label>
								</div>
								<div class="col-sm-6 text-right">
									<a href="login_password_recover.html">忘记密码?</a>
								</div>
							</div>
						</div>
						<div class="form-group">
							<t:button id="loginbtn" cssClass="bg-pink-400 btn-block" loadingStartback="formLogin" loadingIcon="icon-spinner4 spinner" icon="icon-arrow-right14" iconDirection="right">登陆</t:button>
						</div>
						<div class="col-sm-6 text-right">
						<a href="<c:url value='/admin/register/registerInf' />">注册 </a>
						</div>
					</div>
				</form>
			</div>
		</div>
	</div>
</div>
<c:if test="${resultKey!=null}">
	<div style="display: none;" class="actionresult">
		<input type="hidden" id="actionresult_result" value="${resultKey.resultType}" />
		<input type="hidden" id="actionresult_message" value="${resultKey.message}" />
	</div>
	<script type="text/javascript">
		$(function(){
			if($(".actionresult").length>0){
				var resultType=$("#actionresult_result").val();
				var message=$("#actionresult_message").val();
				
				$.notify(message,resultType);
				
				if(resultType!="success"){
					$.cookie("thinku",null);
					$.cookie("thinkp",null);
					$("#login_username").val("");
					$("#login_password").val("");
				}
			}
		});
		
	</script>
</c:if>

<!-- /page container -->
<%@ include file="/WEB-INF/views/shared/scripts/topwindow.jsp"%>
<%@ include file="/WEB-INF/views/shared/base/scripts/limitless/default/notifications.jsp"%>
<%@ include file="/WEB-INF/views/shared/base/scripts/limitless/default/formbuttons.jsp"%>
<%@ include file="/WEB-INF/views/shared/base/scripts/limitless/default/formstyling.jsp"%>
</body>
</html>